//
//  viedioViewController.m
//  hainingOASystem
//
//  Created by michael on 2017/12/19.
//  Copyright © 2017年 czd. All rights reserved.
//

#import "viedioViewController.h"

@interface viedioViewController ()

@end

@implementation viedioViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
    appDelegate.allowRotation = YES;
            [[UIDevice currentDevice] setValue:[NSNumber numberWithInteger:UIInterfaceOrientationLandscapeRight] forKey:@"orientation"];

    // Do any additional setup after loading the view.
            self.view.superview.frame = CGRectMake(0, 0, KScreenWidth, KScreenHeight);
    
        UIView *superView = self.view.superview;
    
        [self.view addSubview:superView];
        self.navigationController.navigationBar.hidden = YES;
 [self.view.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
            [obj removeFromSuperview];
            }];
      _playerView = [[PlayerView alloc] initWithFrame:CGRectMake(0, 0, KScreenHeight, KScreenWidth)];
          _playerView.url = [NSURL URLWithString:_url];

      [self.view addSubview:_playerView];

    [_playerView playVideo];
       [_playerView endPlay:^{
        NSLog(@"播放完成");
    }];
            [_playerView.button addTarget:self action:@selector(maxAction:) forControlEvents:UIControlEventTouchUpInside];

}
 - (void)maxAction:(UIButton *)button
{
[self.navigationController popViewControllerAnimated:YES];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
